<?php
namespace App\Http\Controllers\Admin;
use App\http\Controllers\Controller;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\DB;
class BaseController extends Controller{
    public function __construct()
    {
        // 这个代码是执行最快的，比session_start还快
    }
    public function islogin(){
        $islogin = Session::has("isadmin");
        if ($islogin) {
            $login = Session::get("isadmin");
            if($login==1){
                $iscookie = Cookie::has("name");
                if ($iscookie) {
                    $this->cur_admin = Cookie::get("name");
                    Cookie::queue("name", $this->cur_admin,60);
                    return true;
                }else{
                    Session::forget("isadmin");
                    return false;
                }
            }else{
                Session::forget("isadmin");
                return false;
            }
        }else{
            Session::forget("isadmin");
            return false;
        }
    }
}

?>